package com.service.atf.base.model;

import com.service.atf.base.core.ByteConvertion;
import com.luotao.devp.base.utils.ByteUtil;

/**
 * User: luotao
 * Date: 12-2-23
 * Time: 15:36:00
 * ��ֵ���б���	Char(10)		MP
 * ��ֵ���п���	Char(30)		MP
 * ������ˮID	Char(50)		MP
 * ���б�ע��Ϣ	Char(50)		MP
 */
public class TFCharge extends BaseFlow implements ByteConvertion {
    private String bankCode;

    private String bankCardId;

    private String bankFlowId;

    private String bankMemo;

    private byte chargeType;

    public TFCharge() {
        setType((byte) '1');
        setTradeType((byte) '2');
    }

    public byte getChargeType() {
        return chargeType;
    }

    public void setChargeType(byte chargeType) {
        this.chargeType = chargeType;
    }

    public String getBankCode() {
        return bankCode;
    }

    public void setBankCode(String bankCode) {
        this.bankCode = bankCode;
    }

    public String getBankCardId() {
        return bankCardId;
    }

    public void setBankCardId(String bankCardId) {
        this.bankCardId = bankCardId;
    }

    public String getBankFlowId() {
        return bankFlowId;
    }

    public void setBankFlowId(String bankFlowId) {
        this.bankFlowId = bankFlowId;
    }

    public String getBankMemo() {
        return bankMemo;
    }

    public void setBankMemo(String bankMemo) {
        this.bankMemo = bankMemo;
    }

    @Override
    public ByteConvertion byte2Object(byte[] src) {
        byte2ObjectFlow(src);
        setBankCode(ByteUtil.readString(src, LEN_ALL, 10));
        setBankCardId(ByteUtil.readString(src, LEN_ALL + 10, 30));
        setBankFlowId(ByteUtil.readString(src, LEN_ALL + 40, 50));
        setBankMemo(ByteUtil.readString(src, LEN_ALL + 90, 50));
        setChargeType((byte) ByteUtil.read(src, LEN_ALL + 140));
        return null;
    }

    @Override
    public byte[] object2Byte() {
        byte[] flow = object2ByteFlow();
        byte[] result = new byte[LEN_ALL + 141];
        System.arraycopy(flow, 0, result, 0, flow.length);
        ByteUtil.writeString(result, LEN_ALL, getBankCode(), 10);
        ByteUtil.writeString(result, LEN_ALL + 10, getBankCardId(), 30);
        ByteUtil.writeString(result, LEN_ALL + 40, getBankFlowId(), 50);
        ByteUtil.writeString(result, LEN_ALL + 90, getBankMemo(), 50);
        ByteUtil.write(result, LEN_ALL + 140, getChargeType());
        return result;
    }
}
